<!DOCTYPE HTML>
<html>
	<head>
		<title>胜利教育学生管理系统</title>
		<link href="__RESOURCE__/css/common/common.css{:randparam()}" type="text/css" rel="stylesheet" />
		<link href="__RESOURCE__/css/user/permission.css{:randparam()}" type="text/css" rel="stylesheet" />
		<link href="__RESOURCE__/layui/css/layui.css{:randparam()}" type="text/css" rel="stylesheet" />
		<link href="__RESOURCE__/font/iconfont.css{:randparam()}" type="text/css" rel="stylesheet" />
	</head>
	<body>
		<form class="form form-horizontal" id="form-admin-add">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">选择角色组：</label>
				<div class="formControls col-xs-8 col-sm-9 skin-minimal">
					<volist name="role" id="v">
						<div class="check-box">
							<input type="checkbox" id="role_{$v.id}" name="role[]" value="{$v.id}">
							<label for="role_{$v.id}">{$v.title}</label>
						</div>
					</volist>
				</div>
			</div>
			
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否启用：</label>
				<div class="formControls col-xs-8 col-sm-9 skin-minimal">
					<div class="radio-box">
						<input value="1" name="status" type="radio" id="status-1" checked>
						<label for="status-1">启用</label>
					</div>
					<div class="radio-box">
						<input value="0" name="status" type="radio" id="status-2">
						<label for="status-2">禁用</label>
					</div>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
			<input type="hidden" name="id" value="{$uid}" />
		</form>
		<script type="text/javascript">
			$(function(){
				$('.skin-minimal input').iCheck({
					checkboxClass: 'icheckbox-blue',
					radioClass: 'iradio-blue',
					increaseArea: '20%'
				});
				
				$("#form-admin-add").validate({
					rules:{
						name:{
							required:true,
						},
						cid:{
							required:true,
							rangelength:[18,18]
						}
					},
					onkeyup:false,
					focusCleanup:true,
					success:"valid",
					submitHandler:function(form){
						$(form).ajaxSubmit({
							type: 'post',
							url: "{:url('User/userroleall')}" ,
							success: function(data){
								if(data.error=="success"){
									layer.msg('操作成功!',{icon:6,time:1000});
									setTimeout(function(){
										parent.location.replace(parent.location.href)
									},1500);
								}else{
									layer.msg(data.error,{icon:5,time:1000});
								}
							},
			                error: function(err){
								layer.msg('操作失败！',{icon:5,time:1000});
							}
						});
					}
				});
			});
		</script> 
	</body>
</html>